CC          = @CC@
AR          = @AR@
RANLIB      = @RANLIB@
LIBNAME     = @LIBNAME@
srcdir      = @srcdir@
CC_SHL      = @CC_SHL@
SHLIBNAME   = @SHLIBNAME@

INCLUDES    = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include -I../../include  -I${srcdir}/../../../../include -I../../../../include
CFLAGS      = @CPPFLAGS@ @CFLAGS@ $(INCLUDES)

top_builddir  = @master_topbuild_dir@
LIBTOOL       = @LIBTOOL@
C_COMPILE_SHL = $(CC_SHL) 

@VPATH@

AD_BGLOCKLESS_OBJECTS = ad_bglockless.o ad_bglockless_features.o


default: $(LIBNAME)
	@if [ "@ENABLE_SHLIB@" != "none" ] ; then \
	    $(MAKE) $(SHLIBNAME).la ;\
	fi

.SUFFIXES: $(SUFFIXES) .p .lo

.c.o:
	$(CC) $(CFLAGS) -c $<
.c.lo:
	$(C_COMPILE_SHL) $(CFLAGS) -c $< -o _s$*.o
	@mv -f _s$*.o $*.lo

$(LIBNAME): $(AD_BGLOCKLESS_OBJECTS)
	$(AR) $(LIBNAME) $(AD_BGLOCKLESS_OBJECTS)
	$(RANLIB) $(LIBNAME) 

AD_BGLOCKLESS_LOOBJECTS=$(AD_BGLOCKLESS_OBJECTS:.o=.lo)
$(SHLIBNAME).la: $(AD_BGLOCKLESS_LOOBJECTS)
	$(AR) $(SHLIBNAME).la $(AD_BGLOCKLESS_LOOBJECTS)

coverage:
	-@for file in  ${AD_BGLOCKLESS_OBJECTS:.o=.c} ; do \
		gcov -b -f $$file ; done

clean:
	@rm -f *.o *.lo *.gcno *.gcda *.bb *.bbg
	@rm -f ${srcdir}/*.gcno ${srcdir}/*.gcda 
	@rm -f ${srcdir}/*.bb ${srcdir}/*.bbg
